package com.youlu.campus.admin.rd;

import com.youlu.campus.admin.community.service.ActivityService;
import com.yuelin.infrastructure.quantum.common.QResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class RdController {
    @Autowired
    private ActivityService activityService;

    /**
     * 获取排行榜信息
     *
     * @return
     */
    @GetMapping("/rd/rank-data")
    public QResult getRankData(@RequestParam("activityId") String activityId,
                               @RequestParam("userId") String userId) {
        return QResult.success(activityService.getRankInfo(userId, activityId));
    }
    /**
     * 修改排行榜信息
     *
     * @return
     */
    @GetMapping("/rd/rank-data/update")
    public QResult updateRankData(@RequestParam("activityId") String activityId,
                                  @RequestParam("userId") String userId,
                                  @RequestParam("q") Double q) {
        return QResult.success(activityService.updateRankInfo(userId, activityId, q));
    }
}
